﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="UserManagement.aspx.cs" Inherits="UserManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent" runat="Server">
    <div class="contentfull">
        <div class="breadcrumbs">
            <ul id="crumbs">
                <li><a title="My Account" href="UserAccount.aspx">My Account</a>
                    <img src="Content/Images/separator.png" alt="&rarr;" class="separator">User Management</li>
            </ul>
        </div>

        <div id="showMessages">
            <%= GetMessage() %>
        </div>


        <div class="top">
            <div class="innerleft">
                <h1>Account</h1>

                <div class="tabs_box">
                    <ul id="tabs">
                        <li><a href="UserAccount.aspx" class="tabs_off">Settings</a></li>
                        <% if (UserObject.RoleId > 0)
                           { %>
                        <li><a href="UserManagement.aspx" class="tabs_on">User Management</a></li>
                        <%}
                           if (UserObject.RoleId == 1)
                           {%>
                        <li><a href="Employee.aspx" class="tabs_off">Employee Management</a></li>
                        <%}%>
                        <li><a href="AddDevices.aspx" class="tabs_off">App Users & Devices</a></li>
                        <li><a href="DeleteAccount.aspx" class="tabs_off">Account Deactivation</a></li>

                    </ul>
                </div>
            </div>
        </div>


        <fieldset>
            <h2>User Management</h2>
            <form method="post" action="UserManagement.aspx">
                <div class="content">
                    <ul class="data">
                        <li class="group">
                            <strong>Search By User Name/Email : </strong>
                            <input type="text" class="inputed" name="query" id="query" />
                            <input type="submit" name="searchButton" value="Search" class="black_button blarge" /><br />
                        </li>
                        <asp:ListView ID="lstUsers" runat="server" ItemPlaceholderID="itemContainer">
                            <LayoutTemplate>
                                <asp:PlaceHolder ID="itemContainer" runat="server"></asp:PlaceHolder>
                            </LayoutTemplate>
                            <ItemTemplate>
                                <li class="group">
                                    <div runat="server" visible='<%# Eval("EmailAddress").ToString()!="" %>'>
                                        <dd>
                                            <strong>First Name:</strong>  <%#Eval("FirstName")%>
                                        </dd>
                                        <dd>
                                            <strong>Last Name:</strong>  <%#Eval("LastName")%>
                                        </dd>
                                        <dd>
                                            <strong>Phone :</strong>  <%#Eval("PhoneNumber")%>
                                        </dd>
                                    </div>
                                    <dd>
                                        <input type="hidden" value="<%#Eval("UserId")%>" name="userid" />
                                        <strong>User Name :</strong>    <%#Eval("AppUserName")%>
                                    </dd>
                                    <dd>
                                        <strong>Password:</strong>  <%#Eval("Password")%>
                                    </dd>
                                    <dd>
                                        <strong>User Type:</strong>   <%#Eval("UserType")%>
                                    </dd>
                                    <div runat="server" visible='<%# Eval("EmailAddress").ToString()!="" %>'>
                                        <dd>
                                            <strong>Email Address:</strong>  <%#Eval("EmailAddress")%>
                                        </dd>
                                    </div>
                                    <div runat="server" visible='<%# Eval("ClientEmail").ToString()!="" %>'>
                                        <dd>
                                            <strong>Admin Email:</strong> <%#Eval("ClientEmail")%>
                                        </dd>
                                        <dd>
                                            <strong>Allowed Device:</strong> <%#Eval("DeviceCount")%>
                                        </dd>
                                    </div>
                                    <div runat="server" visible='<%# Eval("ClientEmail").ToString()=="" %>'>
                                        <dd>
                                            <strong>Allowed Users:</strong> <%#Eval("DeviceCount")%>
                                        </dd>
                                    </div>

                                    <dd>
                                        <strong>Expiry Date:</strong>  <%#Eval("ExpiryDate")%>
                                    </dd>
                                    <div runat="server" visible='<%# Eval("ClientEmail").ToString()=="" %>'>
                                    <% if (UserObject.RoleId > 0)
                                       { %>
                                     <dd>
                                        <strong>Comments:</strong>  <%# this.GetComments(Eval("UserId").ToString(),Eval("AppUserName").ToString()) %>
                                    </dd>
                                    <% } %>
                                        </div>
                                    <dd>
                                    <a href="EditUsers.aspx?id=<%#Eval("UserId")%>&roleid=0">Edit</a> |  <a href="UserManagement.aspx?action=del&token=deletetokenforappuserandalladmin&id=<%#Eval("UserId")%>&username=<%#Eval("AppUserName")%>">Delete</a>
                                    </dd>
                                </li>
                            </ItemTemplate>
                            <EmptyDataTemplate>
                                <div>
                                    Sorry - No User Found
                                </div>
                            </EmptyDataTemplate>
                        </asp:ListView>
                    </ul>
                </div>
            </form>
        </fieldset>
    </div>
    <div style="clear: both;">&nbsp;</div>
    <script type="text/javascript" >
        function OpenPage(url)
        {
           // window.open()
            window.open(url, '_blank', 'toolbar=no, scrollbars=no, resizable=no, width=450, height=450');
        }
    </script>
</asp:Content>

